//package com.javasm.config;
//
//import com.javasm.common.http.EnumStatus;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.builders.ResponseMessageBuilder;
//import springfox.documentation.schema.ModelRef;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.service.ResponseMessage;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
//
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.List;
////访问地址：http://localhost:8088/swagger-ui.html#
//@Configuration
//@EnableSwagger2
//public class Swagger2Configuration {
//    //api接口包扫描路径
//    public static final String SWAGGER_SCAN_BASE_PACKAGE = "com.javasm";
//    public static final String VERSION = "1.0.0";
//    @Bean
//    public Docket createRestApi() {
//
//        //添加全局响应状态码
//        List<ResponseMessage> responseMessageList = new ArrayList<>();
//        Arrays.stream(EnumStatus.values()).forEach(enumStatus -> {
//            responseMessageList.add(
//                    new ResponseMessageBuilder().code(enumStatus.getStatus()).message(enumStatus.getMessage()).responseModel(
//                            new ModelRef(enumStatus.getMessage())).build()
//            );
//        });
//        return new Docket(DocumentationType.SWAGGER_2)
//                .apiInfo(apiInfo())
//                .globalResponseMessage(RequestMethod.GET,responseMessageList)
//                .globalResponseMessage(RequestMethod.DELETE,responseMessageList)
//                .globalResponseMessage(RequestMethod.POST,responseMessageList)
//                .globalResponseMessage(RequestMethod.PUT,responseMessageList)
//                .select()
//                .apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE))
//                .paths(PathSelectors.any()) // 可以根据url路径设置哪些请求加入文档，忽略哪些请求
//                .build();
//    }
//    private ApiInfo apiInfo() {
//        return new ApiInfoBuilder()
//                .title("Spring boot  Api ") //设置文档的标题
//                .description("Spring boot  Api 接口文档") // 设置文档的描述
//                .version(VERSION) // 设置文档的版本信息-> 1.0.0 Version information
//                .termsOfServiceUrl("http://www.baidu.com") // 设置文档的License信息->1.3 License information
//                .build();
//    }
//}